# Majority Minority Districts as Opportunities for Latina and Latino Representation Replication Code

This document details the steps needed to replicate the figures and tables from the paper "Majority Minority Districts as Opportunities for Latina and Latino Representation".

## Stata Preliminaries

We used Stata 14 to generate the figures and tables for this paper. The only external dependency we use is the `unique` package which can be installed by running the command

```stata
ssc install unique
```

This command is already included in the replication files which make use of the `unique` package.

## Directory Structure

Our replication code has the following structure

GRACE_replication_files/
├─ README.md
├─ data_files/
│  ├─ GRACE_JOP_Replication_7_28_22.dta
│  ├─ GRACE_CVAP_JOP_Replication_7_28_22.dta
├─ do_files/
│  │  ├─ prep_GRACE_data/
│  │  │  ├─ load_prep_GRACE_data.do
│  │  │  ├─ replication_prep.do
│  │  │  ├─ ballot_level_prep.do
│  │  │  ├─ generate_ballot_level_data.do
│  │  ├─ prep_CVAP_data/
│  │  │  ├─ load_prep_CVAP_data.do
│  │  │  ├─ CVAP_data_prep.do
│  ├─ table_1.do
│  ├─ table_2.do
│  ├─ table_3.do
│  ├─ table_4.do
│  ├─ table_5.do
│  ├─ table_A1_1.do
│  ├─ table_A2.do
│  ├─ table_A5_CVAP.do
│  ├─ table_A7_1.do
│  ├─ table_A7_2.do
│  ├─ table_A7_3.do
│  ├─ table_A8.do
│  ├─ figure_1.do
│  ├─ figure_A3_1.do
│  ├─ figure_A4.do
│  ├─ figure_A9_1.do





All paths within the do files are relative to the root folder `GRACE_replication_files`. To run these files as intended, please change your working directory in Stata to the `GRACE_replication_files` folder using the `cd` command.

## Running the code

Once you have changed your working directory. The replication do files can be run individually in Stata with the command:

```stata
do "do_files/table_X.do"
```
where `X` is the table or figure number of interest.

We have also provided the file `generate_all_results.do` which loops through each of the replication files and pauses at the end of each file. This file can be run in Stata with the command:

```stata
do "do_files/generate_all_results.do"
```
Please note that the `generate_all_results.do` file modifies the following Stata session settings:

```stata
capture log close
set more off
pause on
```

Finally, all tables are printed in the Stata console and figures are displayed using Stata's graph viewer.